package com.macro.mall.controller;


import com.macro.mall.common.api.CommonResult;
import com.macro.mall.model.admin.KeysType;
import com.macro.mall.query.KeyTypeQuery;
import com.macro.mall.service.KeysTypeService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("keysType")
public class KeysTypeController {


    @Autowired
    private KeysTypeService keysTypeService;

    /***
     * 查询 keys类型列表
     * @param keyTypeQuery
     * @return
     */
    @GetMapping
    public CommonResult getClassList(KeyTypeQuery keyTypeQuery){
        return keysTypeService.getClassList(keyTypeQuery);
    }


    /***
     * 新增 keys类型列表
     * @return
     */
    @PostMapping
    public CommonResult addClass(@RequestBody KeysType keysType){
        return keysTypeService.edit(keysType);
    }


    /***
     * 修改 keys类型列表
     * @return
     */
    @PutMapping
    public CommonResult updateClass(@RequestBody KeysType keysType){
        return keysTypeService.edit(keysType);
    }


    /***
     * 删除 keys类型列表
     * @return
     */
    @DeleteMapping("/{id}")
    public CommonResult removeClass(@PathVariable(value = "id") String id){
        return keysTypeService.removeClass(id);
    }



    /***
     * id查询 keys类型
     * @return
     */
    @GetMapping("/{id}")
    public CommonResult getClass(@PathVariable(value = "id") String id){
        return keysTypeService.findClass(id);
    }





}
